Built with doc-gen4, running Lean4. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+โ†‘Ctrl+โ†“to navigate, Ctrl+๐Ÿ–ฑ๏ธto focus. On Mac, use Cmdinstead of Ctrl.
import Mathlib.Data.Vector
import Mathlib.Data.Bitvec.Defs
import Mathlib.Data.Bitvec.Lemmas
import Mathlib.Algebra.Group.InjSurj
import Mathlib.Tactic.Ring
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.ZMod.Basic
import Mathlib.Order.Basic

namespace Vector

instance: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ GetElem (Vector ฮฑ n) (Fin n) ฮฑ fun x x => True
instance
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} {n :
Nat: Type
Nat
} :
GetElem: (cont : Type ?u.8) โ†’ (idx : Type ?u.7) โ†’ outParam (Type ?u.6) โ†’ outParam (cont โ†’ idx โ†’ Prop) โ†’ Type (max(max?u.8?u.7)?u.6)
GetElem
(
Vector: Type ?u.9 โ†’ โ„• โ†’ Type ?u.9
Vector
ฮฑ: Type u
ฮฑ
n) (
Fin: โ„• โ†’ Type
Fin
n)
ฮฑ: Type u
ฮฑ
(fun
_: ?m.11
_
_: ?m.14
_
=>
True: Prop
True
) where getElem := fun
v: ?m.45
v
i: ?m.48
i
_: ?m.51
_
=>
v: ?m.45
v
.
1: {ฮฑ : Sort ?u.62} โ†’ {p : ฮฑ โ†’ Prop} โ†’ Subtype p โ†’ ฮฑ
1
[
i: ?m.48
i
.
val: {n : โ„•} โ†’ Fin n โ†’ โ„•
val
] @[simp] theorem
getElem_eq_get: โˆ€ {ฮฑ : Type u} {n : โ„•} (v : Vector ฮฑ n) (i : Fin n), v[i] = get v i
getElem_eq_get
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} {n :
Nat: Type
Nat
} (
v: Vector ฮฑ n
v
:
Vector: Type ?u.637 โ†’ โ„• โ†’ Type ?u.637
Vector
ฮฑ: Type u
ฮฑ
n) (
i: Fin n
i
:
Fin: โ„• โ†’ Type
Fin
n) :
v: Vector ฮฑ n
v
[
i: Fin n
i
] =
v: Vector ฮฑ n
v
.
get: {ฮฑ : Type ?u.692} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Fin n โ†’ ฮฑ
get
i: Fin n
i
:=
rfl: โˆ€ {ฮฑ : Sort ?u.820} {a : ฮฑ}, a = a
rfl
end Vector namespace Bitvec def
width: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
width
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.872
n
โ†’
Nat: Type
Nat
:= fun
_: ?m.880
_
=> n -- Shouldn't this be inferred from the instance above? (as Bitvec is @[reducible])
instance: {n : โ„•} โ†’ GetElem (Bitvec n) (Fin n) Bool fun x x => True
instance
{n :
Nat: Type
Nat
} :
GetElem: (cont : Type ?u.920) โ†’ (idx : Type ?u.919) โ†’ outParam (Type ?u.918) โ†’ outParam (cont โ†’ idx โ†’ Prop) โ†’ Type (max(max?u.920?u.919)?u.918)
GetElem
(
Bitvec: โ„• โ†’ Type
Bitvec
n) (
Fin: โ„• โ†’ Type
Fin
n)
Bool: Type
Bool
(fun
_: ?m.922
_
_: ?m.925
_
=>
True: Prop
True
) where getElem := fun
v: ?m.951
v
i: ?m.954
i
_: ?m.957
_
=>
v: ?m.951
v
.
1: {ฮฑ : Sort ?u.968} โ†’ {p : ฮฑ โ†’ Prop} โ†’ Subtype p โ†’ ฮฑ
1
[
i: ?m.954
i
.
val: {n : โ„•} โ†’ Fin n โ†’ โ„•
val
]
instance: (n : โ„•) โ†’ Inhabited (Bitvec n)
instance
(n :
Nat: Type
Nat
) :
Inhabited: Sort ?u.1494 โ†’ Sort (max1?u.1494)
Inhabited
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := โŸจ
List.replicate: {ฮฑ : Type ?u.1514} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n
true: Bool
true
,

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
โŸฉ def
Fun: (width : โ„•) โ†’ ?m.1590 width
Fun
(
width: โ„•
width
:
Nat: Type
Nat
) :=
Fin: โ„• โ†’ Type
Fin
width: โ„•
width
โ†’
Bool: Type
Bool
/-- convert `Bitvec n` to `Fin n โ†’ Bool` -/ def
ofFun: {width : โ„•} โ†’ Fun width โ†’ Bitvec width
ofFun
{
width: โ„•
width
:
Nat: Type
Nat
} :
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
:=
Vector.ofFn: {ฮฑ : Type ?u.1611} โ†’ {n : โ„•} โ†’ (Fin n โ†’ ฮฑ) โ†’ Vector ฮฑ n
Vector.ofFn
/-- convert `Fin n โ†’ Bool` to `Bitvec n` -/ def
toFun: {width : โ„•} โ†’ Bitvec width โ†’ Fun width
toFun
{
width: โ„•
width
:
Nat: Type
Nat
} :
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
โ†’
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
:=
Vector.get: {ฮฑ : Type ?u.1665} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Fin n โ†’ ฮฑ
Vector.get
instance: {width : โ„•} โ†’ Coe (Fun width) (Bitvec width)
instance
{
width: โ„•
width
:
Nat: Type
Nat
} :
Coe: semiOutParam (Sort ?u.1723) โ†’ Sort ?u.1722 โ†’ Sort (max(max1?u.1723)?u.1722)
Coe
(
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
) (
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
) := โŸจ@
ofFun: {width : โ„•} โ†’ Fun width โ†’ Bitvec width
ofFun
width: โ„•
width
โŸฉ
instance: {width : โ„•} โ†’ Coe (Bitvec width) (Fun width)
instance
{
width: โ„•
width
:
Nat: Type
Nat
} :
Coe: semiOutParam (Sort ?u.1804) โ†’ Sort ?u.1803 โ†’ Sort (max(max1?u.1804)?u.1803)
Coe
(
Bitvec: โ„• โ†’ Type
Bitvec
width: โ„•
width
) (
Fun: โ„• โ†’ Type
Fun
width: โ„•
width
) := โŸจ@
toFun: {width : โ„•} โ†’ Bitvec width โ†’ Fun width
toFun
width: โ„•
width
โŸฉ def
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
:
Vector: Type ?u.1886 โ†’ โ„• โ†’ Type ?u.1886
Vector
Bool: Type
Bool
n: ?m.1882
n
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.1882
n
:=
id: {ฮฑ : Sort ?u.1892} โ†’ ฮฑ โ†’ ฮฑ
id
-- inspired by: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Defining.20my.20own.20numerals -- not ideal solution, as hard to type, but should be ok for now prefix:max "๐Ÿถ" => fun v =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
false: Bool
false
v) prefix:max "๐Ÿท" => fun v =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
true: Bool
true
v) notation:max "๐Ÿถ" =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
false: Bool
false
(@
Vector.nil: {ฮฑ : Type u} โ†’ Vector ฮฑ 0
Vector.nil
Bool: Type
Bool
)) notation:max "๐Ÿท" =>
ofVector: {n : โ„•} โ†’ Vector Bool n โ†’ Bitvec n
ofVector
(
Vector.cons: {ฮฑ : Type u} โ†’ {n : โ„•} โ†’ ฮฑ โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (Nat.succ n)
Vector.cons
true: Bool
true
(@
Vector.nil: {ฮฑ : Type u} โ†’ Vector ฮฑ 0
Vector.nil
Bool: Type
Bool
))
instance: {n : โ„•} โ†’ Add (Bitvec n)
instance
:
Add: Type ?u.124790 โ†’ Type ?u.124790
Add
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.124787
n
) where add :=
Bitvec.add: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.add
instance: {n : โ„•} โ†’ Sub (Bitvec n)
instance
:
Sub: Type ?u.124884 โ†’ Type ?u.124884
Sub
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.124881
n
) where sub :=
Bitvec.sub: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.sub
-- examples: -- #eval (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat -- #eval (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท).toNat -- #eval (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) + (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.toNat -- #eval ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท + ๐Ÿถ๐Ÿท๐Ÿท๐Ÿท -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) true -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) false -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) true |>.toNat -- #eval Bitvec.adc (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿท๐Ÿท๐Ÿท) false |>.toNat -- -- #eval Bitvec.adc (๐Ÿถ) (๐Ÿถ) true -- #eval Bitvec.adc (๐Ÿถ) (๐Ÿถ) false def
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.124981
2
^ n) :=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
theorem
toZMod_val: โˆ€ {n : โ„•} (v : Bitvec n), ZMod.val (toZMod v) = Bitvec.toNat v
toZMod_val
{n :
โ„•: Type
โ„•
} (
v: Bitvec n
v
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
v: Bitvec n
v
).
val: {n : โ„•} โ†’ ZMod n โ†’ โ„•
val
=
v: Bitvec n
v
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
def
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
{n :
โ„•: Type
โ„•
} (
x: ZMod (2 ^ n)
x
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.125738
2
^ n)) :
Bitvec: โ„• โ†’ Type
Bitvec
n :=
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
_
x: ZMod (2 ^ n)
x
.
val: {n : โ„•} โ†’ ZMod n โ†’ โ„•
val
theorem
toZMod_ofZMod: โˆ€ {n : โ„•} (i : ZMod (2 ^ n)), toZMod (ofZMod i) = i
toZMod_ofZMod
{
n: ?m.125895
n
} (
i: ZMod (2 ^ n)
i
:
ZMod: โ„• โ†’ Type
ZMod
<|
2: ?m.125902
2
^
n: ?m.125895
n
) : (
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
i: ZMod (2 ^ n)
i
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
i: ZMod (2 ^ n)
i
:=
ZMod.val_injective: โˆ€ (n : โ„•) [inst : NeZero n], Function.Injective ZMod.val
ZMod.val_injective
_ (

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
) theorem
ofZMod_toZMod: โˆ€ {n : โ„•} (v : Bitvec n), ofZMod (toZMod v) = v
ofZMod_toZMod
{
n: ?m.126294
n
} (
v: Bitvec n
v
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.126294
n
) :
ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
ofZMod
(
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
v: Bitvec n
v
) =
v: Bitvec n
v
:=

Goals accomplished! ๐Ÿ™

v = v

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_add: โˆ€ (n k : โ„•) (x : List Bool), List.foldl addLsb (n + k) x = 2 ^ List.length x * k + List.foldl addLsb n x
foldl_addLsb_add
: โˆ€ (n k :
โ„•: Type
โ„•
) (x :
List: Type ?u.126377 โ†’ Type ?u.126377
List
Bool: Type
Bool
), x.
foldl: {ฮฑ : Type ?u.126382} โ†’ {ฮฒ : Type ?u.126381} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(n + k) =
2: ?m.126447
2
^ x.
length: {ฮฑ : Type ?u.126456} โ†’ List ฮฑ โ†’ โ„•
length
* k + x.
foldl: {ฮฑ : Type ?u.126461} โ†’ {ฮฒ : Type ?u.126460} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
n | n, k, [] =>

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
| n, k,
a: Bool
a
::l =>

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (addLsb (n + k) a) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (addLsb (n + k) a) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (addLsb n a) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (addLsb n a) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


(n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)

Goals accomplished! ๐Ÿ™
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb ((n + n + bif a then 1 else 0) + (k + k)) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


List.foldl addLsb (n + k + (n + k) + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


2 ^ List.length l * (k + k) + List.foldl addLsb (n + n + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool

this: (n + k + (n + k) + bif a then 1 else 0) = (n + n + bif a then 1 else 0) + (k + k)


2 ^ List.length l * (k + k) + List.foldl addLsb (n + n + bif a then 1 else 0) l = 2 ^ List.length (a :: l) * k + List.foldl addLsb (n + n + bif a then 1 else 0) l
n, k: โ„•

a: Bool

l: List Bool


List.foldl addLsb (n + k) (a :: l) = 2 ^ List.length (a :: l) * k + List.foldl addLsb n (a :: l)

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_eq_add_foldl_addLsb_zero: โˆ€ (x : List Bool) (k : โ„•), List.foldl addLsb k x = 2 ^ List.length x * k + List.foldl addLsb 0 x
foldl_addLsb_eq_add_foldl_addLsb_zero
(x :
List: Type ?u.129075 โ†’ Type ?u.129075
List
Bool: Type
Bool
) (k :
โ„•: Type
โ„•
) : x.
foldl: {ฮฑ : Type ?u.129082} โ†’ {ฮฒ : Type ?u.129081} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
k =
2: ?m.129107
2
^ x.
length: {ฮฑ : Type ?u.129116} โ†’ List ฮฑ โ†’ โ„•
length
* k + x.
foldl: {ฮฑ : Type ?u.129121} โ†’ {ฮฒ : Type ?u.129120} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129136
0
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
foldl_addLsb_cons_zero: โˆ€ (a : Bool) (x : List Bool), List.foldl addLsb 0 (a :: x) = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x
foldl_addLsb_cons_zero
(
a: Bool
a
:
Bool: Type
Bool
) (x :
List: Type ?u.129428 โ†’ Type ?u.129428
List
Bool: Type
Bool
) : (
a: Bool
a
::x).
foldl: {ฮฑ : Type ?u.129436} โ†’ {ฮฒ : Type ?u.129435} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129451
0
=
2: ?m.129471
2
^x.
length: {ฮฑ : Type ?u.129480} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.129484} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
a: Bool
a
1: ?m.129487
1
0: ?m.129497
0
+ x.
foldl: {ฮฑ : Type ?u.129505} โ†’ {ฮฒ : Type ?u.129504} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129520
0
:= calc (
a: Bool
a
::x).
foldl: {ฮฑ : Type ?u.129673} โ†’ {ฮฒ : Type ?u.129672} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.129688
0
= x.
foldl: {ฮฑ : Type ?u.129691} โ†’ {ฮฒ : Type ?u.129690} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
0: ?m.129712
0
+
0: ?m.129723
0
+
cond: {ฮฑ : Type ?u.129733} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
a: Bool
a
1: ?m.129736
1
0: ?m.129746
0
) :=
rfl: โˆ€ {ฮฑ : Sort ?u.129816} {a : ฮฑ}, a = a
rfl
_: ?mโœ
_
=
_: ?m.129871
_
:=

Goals accomplished! ๐Ÿ™

List.foldl addLsb (0 + 0 + bif a then 1 else 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

List.foldl addLsb (0 + 0 + bif a then 1 else 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

(2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb (0 + 0) x = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x

Goals accomplished! ๐Ÿ™
theorem
toNat_adc_aux: โˆ€ {x y : List Bool}, List.length x = List.length y โ†’ List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd = List.foldl addLsb 0 x + List.foldl addLsb 0 y
toNat_adc_aux
: โˆ€ {x y:
List: Type ?u.129977 โ†’ Type ?u.129977
List
Bool: Type
Bool
} (_h :
List.length: {ฮฑ : Type ?u.129984} โ†’ List ฮฑ โ†’ โ„•
List.length
x =
List.length: {ฮฑ : Type ?u.129988} โ†’ List ฮฑ โ†’ โ„•
List.length
y),
List.foldl: {ฮฑ : Type ?u.129996} โ†’ {ฮฒ : Type ?u.129995} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130006
0
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.130019} โ†’ {ฯƒ : Type ?u.130018} โ†’ {ฮฑ : Type ?u.130017} โ†’ {ฮฒ : Type ?u.130016} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.130025
x
y: ?m.130028
y
c: ?m.130031
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
x: ?m.130025
x
y: ?m.130028
y
c: ?m.130031
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.130025
x
y: ?m.130028
y
c: ?m.130031
c
)) x y
false: Bool
false
).
fst: {ฮฑ : Type ?u.130050} โ†’ {ฮฒ : Type ?u.130049} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
) (
List.mapAccumrโ‚‚: {ฯ† : Type ?u.130056} โ†’ {ฯƒ : Type ?u.130055} โ†’ {ฮฑ : Type ?u.130054} โ†’ {ฮฒ : Type ?u.130053} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.130062
x
y: ?m.130065
y
c: ?m.130068
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
x: ?m.130062
x
y: ?m.130065
y
c: ?m.130068
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.130062
x
y: ?m.130065
y
c: ?m.130068
c
)) x y
false: Bool
false
).
snd: {ฮฑ : Type ?u.130085} โ†’ {ฮฒ : Type ?u.130084} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
=
List.foldl: {ฮฑ : Type ?u.130092} โ†’ {ฮฒ : Type ?u.130091} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130102
0
x +
List.foldl: {ฮฑ : Type ?u.130105} โ†’ {ฮฒ : Type ?u.130104} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.130115
0
y | [], [], _ =>
rfl: โˆ€ {ฮฑ : Sort ?u.130200} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x,
b: Bool
b
::y,
h: List.length (a :: x) = List.length (b :: y)
h
=>

Goals accomplished! ๐Ÿ™

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = (2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x + ((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (List.foldl addLsb 0 x + List.foldl addLsb 0 y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst) (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst) (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry a b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

List.foldl addLsb (addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst)) (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd = List.foldl addLsb 0 (a :: x) + List.foldl addLsb 0 (b :: y)

false
2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && b || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true
2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && b || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false
2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && b || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true
2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && b || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.false
2 ^ List.length (xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && false || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true
2 ^ List.length (xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && true || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.false
2 ^ List.length (xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && false || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true
2 ^ List.length (xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (false && true || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif false then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.false
2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && false || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif false then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.true
2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (true && true || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif true then 1 else 0) + 2 ^ List.length y * bif true then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

Goals accomplished! ๐Ÿ™

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true
(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false
(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

true.false.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

false.true.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

false.true.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.false
(2 ^ List.length y * bif false then 0 else 1) + ((2 ^ List.length y * bif false then 1 else 0) + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif false then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

true.false.true
(2 ^ List.length y * bif true then 0 else 1) + ((2 ^ List.length y * bif true then 1 else 0) + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)) = 2 ^ List.length y + ((2 ^ List.length y * bif true then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor x (xor y c))) x y false).snd)

2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) * addLsb 0 (a && b || a && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst) + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd) = ((2 ^ List.length x * bif a then 1 else 0) + 2 ^ List.length y * bif b then 1 else 0) + (2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd * addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).fst + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (x && y || x && c || y && c, xor (xor x y) c)) x y false).snd)

Goals accomplished! ๐Ÿ™
theorem
toNat_adc: โˆ€ {n : โ„•} {x y : Bitvec n}, Bitvec.toNat (adc x y false) = Bitvec.toNat x + Bitvec.toNat y
toNat_adc
{n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n} : (
Bitvec.adc: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bitvec (n + 1)
Bitvec.adc
x: Bitvec n
x
y: Bitvec n
y
false: Bool
false
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
+
y: Bitvec n
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
:=

Goals accomplished! ๐Ÿ™

mk
Bitvec.toNat (adc { val := x, property := hx } y false) = Bitvec.toNat { val := x, property := hx } + Bitvec.toNat y

mk.mk
Bitvec.toNat (adc { val := x, property := hx } { val := y, property := hy } false) = Bitvec.toNat { val := x, property := hx } + Bitvec.toNat { val := y, property := hy }

mk.mk
Bitvec.toNat (adc { val := x, property := (_ : List.length x = List.length x) } { val := y, property := hy } false) = Bitvec.toNat { val := x, property := (_ : List.length x = List.length x) } + Bitvec.toNat { val := y, property := hy }

mk.mk
List.foldl addLsb (addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).fst) (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry x y c, Bitvec.xor3 x y c)) x y false).snd = List.foldl addLsb 0 x + List.foldl addLsb 0 y

Goals accomplished! ๐Ÿ™
theorem
toNat_tail: โˆ€ {n : โ„•} (x : Bitvec n), Bitvec.toNat (Vector.tail x) = Bitvec.toNat x % 2 ^ (n - 1)
toNat_tail
: โˆ€ {n :
Nat: Type
Nat
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n),
Bitvec.toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
Bitvec.toNat
x: Bitvec n
x
.
tail: {ฮฑ : Type ?u.143217} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ Vector ฮฑ (n - 1)
tail
=
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
%
2: ?m.143236
2
^(n-
1: ?m.143249
1
) | 0, โŸจ[], _โŸฉ =>
rfl: โˆ€ {ฮฑ : Sort ?u.143445} {a : ฮฑ}, a = a
rfl
| n+1, โŸจ
a: Bool
a
::l,
h: List.length (a :: l) = n + 1
h
โŸฉ =>

Goals accomplished! ๐Ÿ™
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h })
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


Bitvec.toNat (Vector.tail { val := a :: l, property := hโœ }) % 2 ^ (n + 1 - 1) = Bitvec.toNat { val := a :: l, property := hโœ } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 โ†‘(Vector.tail { val := a :: l, property := hโœ }) % 2 ^ (n + 1 - 1) = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

h: List.length (a :: l) = n + 1


Bitvec.toNat (Vector.tail { val := a :: l, property := h }) = Bitvec.toNat { val := a :: l, property := h } % 2 ^ (n + 1 - 1)
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((bif a then 1 else 0) * 2 ^ n + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n


List.foldl addLsb 0 l % 2 ^ n = ((2 ^ n * bif a then 1 else 0) + List.foldl addLsb 0 l) % 2 ^ n
n: โ„•

a: Bool

l: List Bool

hโœ: List.length (a :: l) = n + 1

h: List.length l = n



Goals accomplished! ๐Ÿ™
@[simp] theorem
toNat_add: โˆ€ {n : โ„•} (x y : Bitvec n), Bitvec.toNat (x + y) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n
toNat_add
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
+
y: Bitvec n
y
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
= (
x: Bitvec n
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
+
y: Bitvec n
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) %
2: ?m.145972
2
^n :=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


Bitvec.toNat (adc x y false) % 2 ^ (n + 1 - 1) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n
n: โ„•

x, y: Bitvec n


(Bitvec.toNat x + Bitvec.toNat y) % 2 ^ (n + 1 - 1) = (Bitvec.toNat x + Bitvec.toNat y) % 2 ^ n

Goals accomplished! ๐Ÿ™
theorem
toZMod_add: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x + y) = toZMod x + toZMod y
toZMod_add
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
+
y: Bitvec n
y
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= (
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
+
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
) :=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (x + y) = toZMod x + toZMod y
n: โ„•

x, y: Bitvec n


toZMod (x + y) = toZMod x + toZMod y
n: โ„•

x, y: Bitvec n


a
n: โ„•

x, y: Bitvec n


a

Goals accomplished! ๐Ÿ™
theorem
ofZMod_add: โˆ€ {n : โ„•} (x y : ZMod (2 ^ n)), ofZMod (x + y) = ofZMod x + ofZMod y
ofZMod_add
{n :
โ„•: Type
โ„•
} (
x: ZMod (2 ^ n)
x
y: ZMod (2 ^ n)
y
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.147538
2
^n)) :
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
x: ZMod (2 ^ n)
x
+
y: ZMod (2 ^ n)
y
) =
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
x: ZMod (2 ^ n)
x
+
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
y: ZMod (2 ^ n)
y
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)


n: โ„•

x, y: ZMod (2 ^ n)


ofZMod (x + y) = ofZMod x + ofZMod y
n: โ„•

x, y: ZMod (2 ^ n)



Goals accomplished! ๐Ÿ™
theorem
zero_def: โˆ€ {n : โ„•}, 0 = { val := List.replicate n false, property := (_ : List.length โ†‘0 = n) }
zero_def
: (
0: ?m.148020
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148014
n
) = โŸจ
List.replicate: {ฮฑ : Type ?u.148063} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n: ?m.148014
n
false: Bool
false
, (
0: ?m.148068
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148014
n
).
2: โˆ€ {ฮฑ : Sort ?u.148070} {p : ฮฑ โ†’ Prop} (self : Subtype p), p โ†‘self
2
โŸฉ :=
rfl: โˆ€ {ฮฑ : Sort ?u.148091} {a : ฮฑ}, a = a
rfl
theorem
toList_zero: โˆ€ {n : โ„•}, Vector.toList 0 = List.replicate n false
toList_zero
:
Vector.toList: {ฮฑ : Type ?u.148111} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
Vector.toList
(
0: ?m.148116
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.148107
n
) =
List.replicate: {ฮฑ : Type ?u.148145} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n: ?m.148107
n
false: Bool
false
:=
rfl: โˆ€ {ฮฑ : Sort ?u.148151} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toNat_zero: โˆ€ {n : โ„•}, Bitvec.toNat 0 = 0
toNat_zero
: โˆ€ {n :
Nat: Type
Nat
}, (
0: ?m.148183
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
0: ?m.148215
0
| 0 =>
rfl: โˆ€ {ฮฑ : Sort ?u.148246} {a : ฮฑ}, a = a
rfl
| n+1 =>

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
ofNat_zero: โˆ€ {w : โ„•}, Bitvec.ofNat w 0 = 0
ofNat_zero
:
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.149119
w
0: ?m.149124
0
=
0: ?m.149135
0
:=

Goals accomplished! ๐Ÿ™

0 = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
toZMod_zero: โˆ€ {n : โ„•}, toZMod 0 = 0
toZMod_zero
: โˆ€ {n :
Nat: Type
Nat
}, (
0: ?m.149209
0
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
0: ?m.149257
0
:=

Goals accomplished! ๐Ÿ™

โˆ€ {n : โ„•}, toZMod 0 = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
ofZMod_zero: โˆ€ {n : โ„•}, ofZMod 0 = 0
ofZMod_zero
:
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
0: ?m.151174
0
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.151102
2
^
n: ?m.151092
n
)) =
0: ?m.151477
0
:=

Goals accomplished! ๐Ÿ™

0 = 0

Goals accomplished! ๐Ÿ™
theorem
toList_one: โˆ€ {n : โ„•}, Vector.toList 1 = List.replicate n false ++ [true]
toList_one
{n :
โ„•: Type
โ„•
} : (
1: ?m.151655
1
:
Bitvec: โ„• โ†’ Type
Bitvec
(n +
1: ?m.151594
1
)).
toList: {ฮฑ : Type ?u.151679} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
=
List.replicate: {ฮฑ : Type ?u.151690} โ†’ โ„• โ†’ ฮฑ โ†’ List ฮฑ
List.replicate
n
false: Bool
false
++ [
true: Bool
true
] :=
rfl: โˆ€ {ฮฑ : Sort ?u.151736} {a : ฮฑ}, a = a
rfl
theorem
toNat_one: โˆ€ {n : โ„•}, Bitvec.toNat 1 = if n = 0 then 0 else 1
toNat_one
: โˆ€ {n :
Nat: Type
Nat
}, (
1: ?m.151812
1
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
= if n =
0: ?m.151845
0
then
0: ?m.151870
0
else
1: ?m.151881
1
| 0 =>
rfl: โˆ€ {ฮฑ : Sort ?u.151924} {a : ฮฑ}, a = a
rfl
| 1 =>
rfl: โˆ€ {ฮฑ : Sort ?u.151975} {a : ฮฑ}, a = a
rfl
| n+2 =>

Goals accomplished! ๐Ÿ™

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1
n: โ„•

this: Bitvec.toNat 1 = if n + 1 = 0 then 0 else 1


Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Bitvec.toNat 1 = if n + 2 = 0 then 0 else 1

Goals accomplished! ๐Ÿ™
@[simp] theorem
toZMod_one: โˆ€ {n : โ„•}, toZMod 1 = 1
toZMod_one
: โˆ€ {n :
Nat: Type
Nat
}, (
1: ?m.154966
1
:
Bitvec: โ„• โ†’ Type
Bitvec
n).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
1: ?m.155014
1
:=

Goals accomplished! ๐Ÿ™

โˆ€ {n : โ„•}, toZMod 1 = 1

Goals accomplished! ๐Ÿ™
@[simp] theorem
ofZMod_one: โˆ€ {n : โ„•}, ofZMod 1 = 1
ofZMod_one
:
Bitvec.ofZMod: {n : โ„•} โ†’ ZMod (2 ^ n) โ†’ Bitvec n
Bitvec.ofZMod
(
1: ?m.159114
1
:
ZMod: โ„• โ†’ Type
ZMod
(
2: ?m.159042
2
^
n: ?m.159032
n
)) =
1: ?m.159327
1
:=

Goals accomplished! ๐Ÿ™

1 = 1

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ SMul โ„• (Bitvec n)
instance
:
SMul: Type ?u.159443 โ†’ Type ?u.159442 โ†’ Type (max?u.159443?u.159442)
SMul
โ„•: Type
โ„•
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.159439
n
) := โŸจ
nsmulRec: {M : Type ?u.159455} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ โ„• โ†’ M โ†’ M
nsmulRec
โŸฉ theorem
nsmul_def: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), y โ€ข x = nsmulRec y x
nsmul_def
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„•: Type
โ„•
) : y โ€ข
x: Bitvec n
x
=
nsmulRec: {M : Type ?u.159770} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ โ„• โ†’ M โ†’ M
nsmulRec
y
x: Bitvec n
x
:=
rfl: โˆ€ {ฮฑ : Sort ?u.159802} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toZMod_nsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_nsmul
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„•: Type
โ„•
) : (y โ€ข
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= y โ€ข
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_sub_aux: โˆ€ {x y : List Bool}, List.length x = List.length y โ†’ (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y)
toInt_sub_aux
: โˆ€ {x y :
List: Type ?u.164287 โ†’ Type ?u.164287
List
Bool: Type
Bool
} (_hx :
List.length: {ฮฑ : Type ?u.164294} โ†’ List ฮฑ โ†’ โ„•
List.length
x =
List.length: {ฮฑ : Type ?u.164298} โ†’ List ฮฑ โ†’ โ„•
List.length
y), (โ†‘(
List.foldl: {ฮฑ : Type ?u.164310} โ†’ {ฮฒ : Type ?u.164309} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.164320
0
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.164333} โ†’ {ฯƒ : Type ?u.164332} โ†’ {ฮฑ : Type ?u.164331} โ†’ {ฮฒ : Type ?u.164330} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.164339
x
y: ?m.164342
y
c: ?m.164345
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
(!
x: ?m.164339
x
)
y: ?m.164342
y
c: ?m.164345
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.164339
x
y: ?m.164342
y
c: ?m.164345
c
)) x y
false: Bool
false
).
snd: {ฮฑ : Type ?u.164364} โ†’ {ฮฒ : Type ?u.164363} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
) :
โ„ค: Type
โ„ค
) -
2: ?m.164424
2
^ x.
length: {ฮฑ : Type ?u.164433} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.164437} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
(
List.mapAccumrโ‚‚: {ฯ† : Type ?u.164442} โ†’ {ฯƒ : Type ?u.164441} โ†’ {ฮฑ : Type ?u.164440} โ†’ {ฮฒ : Type ?u.164439} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— ฯ†) โ†’ List ฮฑ โ†’ List ฮฒ โ†’ ฯƒ โ†’ ฯƒ ร— List ฯ†
List.mapAccumrโ‚‚
(fun
x: ?m.164448
x
y: ?m.164451
y
c: ?m.164454
c
=> (
Bitvec.carry: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.carry
(!
x: ?m.164448
x
)
y: ?m.164451
y
c: ?m.164454
c
,
Bitvec.xor3: Bool โ†’ Bool โ†’ Bool โ†’ Bool
Bitvec.xor3
x: ?m.164448
x
y: ?m.164451
y
c: ?m.164454
c
)) x y
false: Bool
false
).
fst: {ฮฑ : Type ?u.164471} โ†’ {ฮฒ : Type ?u.164470} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
1: ?m.164475
1
0: ?m.164485
0
= โ†‘(
List.foldl: {ฮฑ : Type ?u.164829} โ†’ {ฮฒ : Type ?u.164828} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.164839
0
x) + -โ†‘(
List.foldl: {ฮฑ : Type ?u.164873} โ†’ {ฮฒ : Type ?u.164872} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.164883
0
y) | [], [], _ =>
rfl: โˆ€ {ฮฑ : Sort ?u.165301} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x,
b: Bool
b
::y,
h: List.length (a :: x) = List.length (b :: y)
h
=>

Goals accomplished! ๐Ÿ™

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x) + -โ†‘((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + -โ†‘((2 ^ List.length y * bif b then 1 else 0) + List.foldl addLsb 0 y)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + -(โ†‘(2 ^ List.length y * bif b then 1 else 0) + โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x) + (-โ†‘(2 ^ List.length y * bif b then 1 else 0) + -โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd) - 2 ^ List.length (a :: x) * bif (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).snd) - 2 ^ List.length (a :: x) * bif (let r := List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false; let q := (Bitvec.carry (!a) b r.fst, Bitvec.xor3 a b r.fst); (q.fst, q.snd :: r.snd)).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) (a :: x) (b :: y) false).fst then 1 else 0) = โ†‘(List.foldl addLsb 0 (a :: x)) + -โ†‘(List.foldl addLsb 0 (b :: y))

false
(โ†‘(2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && b || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true
(โ†‘(2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && b || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false
(โ†‘(2 ^ List.length (xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && b || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true
(โ†‘(2 ^ List.length (xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && b || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
(โ†‘(2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && false || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true
(โ†‘(2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && true || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
(โ†‘(2 ^ List.length (xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && false || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.true
(โ†‘(2 ^ List.length (xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor false true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (false :: x) * bif !false && true || !false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif false then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.false
(โ†‘(2 ^ List.length (xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true false) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && false || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || false && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif false then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true
(โ†‘(2 ^ List.length (xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor true true) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (true :: x) * bif !true && true || !true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || true && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif true then 1 else 0) + -โ†‘(2 ^ List.length y * bif true then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.true
-(2 ^ List.length y + 2 ^ List.length y) + (โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd)) = -โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + 2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)

false.true
-(2 ^ List.length y + 2 ^ List.length y) + (โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd)) = -โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

true.false
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0))

true.true
โ†‘2 ^ List.length y * โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -((2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) + 2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)) = โ†‘2 ^ List.length y + (-โ†‘2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -(2 ^ List.length y * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0)))

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y

false.true
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

true.false
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.true
โ†‘(bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).fst then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

true.true.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

true.true.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

false.false.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

false.true.false
โ†‘(bif false then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif false then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

false.true.true
โ†‘(bif true then 0 else 1) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-((bif true then 1 else 0) * 2 ^ List.length y) - 2 ^ List.length y)

true.false.false
โ†‘(bif false then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.false.true
โ†‘(bif true then 0 else 1) * 2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y + 2 ^ List.length y

true.true.false
โ†‘(bif false then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif false then 1 else 0) * 2 ^ List.length y

true.true.true
โ†‘(bif true then 1 else 0) * 2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - (bif true then 1 else 0) * 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

Goals accomplished! ๐Ÿ™

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

false.false.true
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y

false.true.false
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + -2 ^ List.length y

false.true.true
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2 = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + (-2 ^ List.length y - 2 ^ List.length y)

true.false.false
2 ^ List.length y + โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) + 2 ^ List.length y

true.true.true
2 ^ List.length y + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y * 2) = โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor x (xor y c))) x y false).snd) - 2 ^ List.length y

(โ†‘(2 ^ List.length (xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst :: (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) * 0 + ((2 ^ List.length (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd * bif xor (xor a b) (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd)) - 2 ^ List.length (a :: x) * bif !a && b || !a && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst || b && (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0) = โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(2 ^ List.length y * bif b then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (!x && y || !x && c || y && c, xor (xor x y) c)) x y false).fst then 1 else 0)

Goals accomplished! ๐Ÿ™
instance: โˆ€ (n : โ„•), NeZero (2 ^ n)
instance
(n :
โ„•: Type
โ„•
) :
NeZero: {R : Type ?u.189827} โ†’ [inst : Zero R] โ†’ R โ†’ Prop
NeZero
(
2: ?m.189909
2
^ n) := โŸจ
Nat.pos_iff_ne_zero: โˆ€ {n : โ„•}, 0 < n โ†” n โ‰  0
Nat.pos_iff_ne_zero
.
1: โˆ€ {a b : Prop}, (a โ†” b) โ†’ a โ†’ b
1
<|
pow_pos: โˆ€ {ฮฑ : Type ?u.190085} [inst : StrictOrderedSemiring ฮฑ] {a : ฮฑ}, 0 < a โ†’ โˆ€ (n : โ„•), 0 < a ^ n
pow_pos
(

Goals accomplished! ๐Ÿ™

0 < 2

Goals accomplished! ๐Ÿ™
) _โŸฉ theorem
toZMod_sbb: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (sbb x y false).snd = toZMod x - toZMod y
toZMod_sbb
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
.
sbb: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bool ร— Bitvec n
sbb
y: Bitvec n
y
false: Bool
false
).
2: {ฮฑ : Type ?u.190202} โ†’ {ฮฒ : Type ?u.190201} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
2
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
-
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk
toZMod (sbb { val := x, property := hx } y false).snd = toZMod { val := x, property := hx } - toZMod y
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
toZMod (sbb { val := x, property := hx } { val := y, property := hy } false).snd = toZMod { val := x, property := hx } - toZMod { val := y, property := hy }
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)

Goals accomplished! ๐Ÿ™

2 ^ n = 0

2 ^ n = 0

โ†‘2 ^ n = 0

2 ^ n = 0

โ†‘(2 ^ n) = 0

2 ^ n = 0

0 = 0

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y
n: โ„•

x: List Bool

hx: List.length x = n

y: List Bool

hy: List.length y = n

h2n: 2 ^ n = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) - 2 ^ List.length x * bif (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).fst then 1 else 0) = โ†‘(โ†‘(List.foldl addLsb 0 x) + -โ†‘(List.foldl addLsb 0 y))


mk.mk
โ†‘(List.foldl addLsb 0 (List.mapAccumrโ‚‚ (fun x y c => (Bitvec.carry (!x) y c, Bitvec.xor3 x y c)) x y false).snd) = โ†‘(List.foldl addLsb 0 x) - โ†‘(List.foldl addLsb 0 y)
n: โ„•

x, y: Bitvec n


toZMod (sbb x y false).snd = toZMod x - toZMod y

Goals accomplished! ๐Ÿ™
theorem
toZMod_sub: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x - y) = toZMod x - toZMod y
toZMod_sub
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (
x: Bitvec n
x
-
y: Bitvec n
y
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
=
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
-
y: Bitvec n
y
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=
toZMod_sbb: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (sbb x y false).snd = toZMod x - toZMod y
toZMod_sbb
x: Bitvec n
x
y: Bitvec n
y
theorem
toInt_neg_aux: โˆ€ (x : List Bool), (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 x)
toInt_neg_aux
: โˆ€ (x :
List: Type ?u.198320 โ†’ Type ?u.198320
List
Bool: Type
Bool
), ((
List.foldl: {ฮฑ : Type ?u.198330} โ†’ {ฮฒ : Type ?u.198329} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
(
0: ?m.198341
0
:
โ„•: Type
โ„•
) (
List.mapAccumr: {ฯƒ : Type ?u.198353} โ†’ {ฮฑ : Type ?u.198352} โ†’ {ฮฒ : Type ?u.198351} โ†’ (ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— ฮฒ) โ†’ List ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— List ฮฒ
List.mapAccumr
(fun
y: ?m.198358
y
c: ?m.198361
c
=> (
y: ?m.198358
y
||
c: ?m.198361
c
,
xor: Bool โ†’ Bool โ†’ Bool
xor
y: ?m.198358
y
c: ?m.198361
c
)) x
false: Bool
false
).
snd: {ฮฑ : Type ?u.198379} โ†’ {ฮฒ : Type ?u.198378} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฒ
snd
:
โ„•: Type
โ„•
) -
2: ?m.198389
2
^ x.
length: {ฮฑ : Type ?u.198398} โ†’ List ฮฑ โ†’ โ„•
length
*
cond: {ฮฑ : Type ?u.198402} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
(
List.mapAccumr: {ฯƒ : Type ?u.198406} โ†’ {ฮฑ : Type ?u.198405} โ†’ {ฮฒ : Type ?u.198404} โ†’ (ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— ฮฒ) โ†’ List ฮฑ โ†’ ฯƒ โ†’ ฯƒ ร— List ฮฒ
List.mapAccumr
(fun
y: ?m.198411
y
c: ?m.198414
c
=> (
y: ?m.198411
y
||
c: ?m.198414
c
,
xor: Bool โ†’ Bool โ†’ Bool
xor
y: ?m.198411
y
c: ?m.198414
c
)) x
false: Bool
false
).
fst: {ฮฑ : Type ?u.198429} โ†’ {ฮฒ : Type ?u.198428} โ†’ ฮฑ ร— ฮฒ โ†’ ฮฑ
fst
1: ?m.198433
1
0: ?m.198443
0
:
โ„ค: Type
โ„ค
) = -(
List.foldl: {ฮฑ : Type ?u.198836} โ†’ {ฮฒ : Type ?u.198835} โ†’ (ฮฑ โ†’ ฮฒ โ†’ ฮฑ) โ†’ ฮฑ โ†’ List ฮฒ โ†’ ฮฑ
List.foldl
addLsb: โ„• โ†’ Bool โ†’ โ„•
addLsb
0: ?m.198846
0
x) | [] =>
rfl: โˆ€ {ฮฑ : Sort ?u.199204} {a : ฮฑ}, a = a
rfl
|
a: Bool
a
::x =>

Goals accomplished! ๐Ÿ™

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘((2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘((2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘((2 ^ List.length x * bif a then 1 else 0) + List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(โ†‘(2 ^ List.length x * bif a then 1 else 0) + โ†‘(List.foldl addLsb 0 x))

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + -โ†‘(List.foldl addLsb 0 x)

(โ†‘(List.foldl addLsb 0 (xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst :: (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(2 ^ List.length (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd * bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length (a :: x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -โ†‘(2 ^ List.length x * bif a then 1 else 0) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).snd) - 2 ^ List.length (a :: x) * bif (List.mapAccumr (fun y c => (y || c, xor y c)) (a :: x) false).fst then 1 else 0) = -โ†‘(List.foldl addLsb 0 (a :: x))

false
(2 ^ List.length x * โ†‘(bif xor false (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true
(2 ^ List.length x * โ†‘(bif xor true (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false
(2 ^ List.length x * โ†‘(bif xor false (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true
(2 ^ List.length x * โ†‘(bif xor true (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true.false
(2 ^ List.length x * โ†‘(bif xor true false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

true.true
(2 ^ List.length x * โ†‘(bif xor true true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false.false
(2 ^ List.length x * โ†‘(bif xor false false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

false.true
(2 ^ List.length x * โ†‘(bif xor false true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif false || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif false then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

true.false
(2 ^ List.length x * โ†‘(bif xor true false then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || false then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif false then 1 else 0)

true.true
(2 ^ List.length x * โ†‘(bif xor true true then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif true || true then 1 else 0) = -(2 ^ List.length x * โ†‘(bif true then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif true then 1 else 0)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

true.false
2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

false.true
2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + -2 ^ List.length x

true.false
2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd)

true.true
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + (-2 ^ List.length x + -2 ^ List.length x) = -2 ^ List.length x + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) + -2 ^ List.length x)

(2 ^ List.length x * โ†‘(bif xor a (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) + โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ Nat.succ (List.length x) * bif a || (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = -(2 ^ List.length x * โ†‘(bif a then 1 else 0)) + (โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0)

Goals accomplished! ๐Ÿ™
theorem
toZMod_neg: โˆ€ {n : โ„•} (x : Bitvec n), toZMod (-x) = -toZMod x
toZMod_neg
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) : (-
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= -
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

mk
toZMod (Bitvec.neg { val := x, property := hx }) = -toZMod { val := x, property := hx }

mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

Goals accomplished! ๐Ÿ™

2 ^ n = 0

2 ^ n = 0

โ†‘2 ^ n = 0

2 ^ n = 0

โ†‘(2 ^ n) = 0

2 ^ n = 0

0 = 0

Goals accomplished! ๐Ÿ™
n: โ„•

x: List Bool

hx: List.length x = n

h2n: 2 ^ n = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = โ†‘(-โ†‘(List.foldl addLsb 0 x))


mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)
x: List Bool

h2n: 2 ^ List.length x = 0

this: โ†‘(โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) - 2 ^ List.length x * bif (List.mapAccumr (fun y c => (y || c, xor y c)) x false).fst then 1 else 0) = โ†‘(-โ†‘(List.foldl addLsb 0 x))


mk
โ†‘(List.foldl addLsb 0 (List.mapAccumr (fun y c => (y || c, xor y c)) x false).snd) = -โ†‘(List.foldl addLsb 0 x)

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ SMul โ„ค (Bitvec n)
instance
:
SMul: Type ?u.224006 โ†’ Type ?u.224005 โ†’ Type (max?u.224006?u.224005)
SMul
โ„ค: Type
โ„ค
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.224002
n
) := โŸจ
zsmulRec: {M : Type ?u.224018} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ [inst : Neg M] โ†’ โ„ค โ†’ M โ†’ M
zsmulRec
โŸฉ theorem
zsmul_def: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), y โ€ข x = zsmulRec y x
zsmul_def
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„ค: Type
โ„ค
) : y โ€ข
x: Bitvec n
x
=
zsmulRec: {M : Type ?u.224405} โ†’ [inst : Zero M] โ†’ [inst : Add M] โ†’ [inst : Neg M] โ†’ โ„ค โ†’ M โ†’ M
zsmulRec
y
x: Bitvec n
x
:=
rfl: โˆ€ {ฮฑ : Sort ?u.224448} {a : ฮฑ}, a = a
rfl
@[simp] theorem
toZMod_zsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_zsmul
{n :
โ„•: Type
โ„•
} (
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n) (y :
โ„ค: Type
โ„ค
) : (y โ€ข
x: Bitvec n
x
).
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
= y โ€ข
x: Bitvec n
x
.
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
instance: {n : โ„•} โ†’ AddCommGroup (Bitvec n)
instance
:
AddCommGroup: Type ?u.228933 โ†’ Type ?u.228933
AddCommGroup
(
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.228930
n
) :=
Function.Injective.addCommGroup: {Mโ‚ : Type ?u.228937} โ†’ {Mโ‚‚ : Type ?u.228936} โ†’ [inst : Add Mโ‚] โ†’ [inst_1 : Zero Mโ‚] โ†’ [inst_2 : SMul โ„• Mโ‚] โ†’ [inst_3 : Neg Mโ‚] โ†’ [inst_4 : Sub Mโ‚] โ†’ [inst_5 : SMul โ„ค Mโ‚] โ†’ [inst_6 : AddCommGroup Mโ‚‚] โ†’ (f : Mโ‚ โ†’ Mโ‚‚) โ†’ Function.Injective f โ†’ f 0 = 0 โ†’ (โˆ€ (x y : Mโ‚), f (x + y) = f x + f y) โ†’ (โˆ€ (x : Mโ‚), f (-x) = -f x) โ†’ (โˆ€ (x y : Mโ‚), f (x - y) = f x - f y) โ†’ (โˆ€ (x : Mโ‚) (n : โ„•), f (n โ€ข x) = n โ€ข f x) โ†’ (โˆ€ (x : Mโ‚) (n : โ„ค), f (n โ€ข x) = n โ€ข f x) โ†’ AddCommGroup Mโ‚
Function.Injective.addCommGroup
toZMod: {n : โ„•} โ†’ Bitvec n โ†’ ZMod (2 ^ n)
toZMod
(
Function.injective_iff_hasLeftInverse: โˆ€ {ฮฑ : Sort ?u.229369} {ฮฒ : Sort ?u.229370} [inst : Nonempty ฮฑ] {f : ฮฑ โ†’ ฮฒ}, Function.Injective f โ†” Function.HasLeftInverse f
Function.injective_iff_hasLeftInverse
.
2: โˆ€ {a b : Prop}, (a โ†” b) โ†’ b โ†’ a
2
โŸจ
_: ?m.229436
_
,
ofZMod_toZMod: โˆ€ {n : โ„•} (v : Bitvec n), ofZMod (toZMod v) = v
ofZMod_toZMod
โŸฉ)
toZMod_zero: โˆ€ {n : โ„•}, toZMod 0 = 0
toZMod_zero
toZMod_add: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x + y) = toZMod x + toZMod y
toZMod_add
toZMod_neg: โˆ€ {n : โ„•} (x : Bitvec n), toZMod (-x) = -toZMod x
toZMod_neg
toZMod_sub: โˆ€ {n : โ„•} (x y : Bitvec n), toZMod (x - y) = toZMod x - toZMod y
toZMod_sub
toZMod_nsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„•), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_nsmul
toZMod_zsmul: โˆ€ {n : โ„•} (x : Bitvec n) (y : โ„ค), toZMod (y โ€ข x) = y โ€ข toZMod x
toZMod_zsmul
-- see https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Pattern.20matching.20subtypes def
add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
add?
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
Option: Type ?u.230221 โ†’ Type ?u.230221
Option
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := match
Bitvec.adc: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bool โ†’ Bitvec (n + 1)
Bitvec.adc
x: Bitvec n
x
y: Bitvec n
y
false: Bool
false
with | โŸจ
false: Bool
false
:: z,
hcons: List.length (false :: z) = n + 1
hcons
โŸฉ =>
some: {ฮฑ : Type ?u.230271} โ†’ ฮฑ โ†’ Option ฮฑ
some
โŸจz,

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n

z: List Bool

hcons: List.length (false :: z) = n + 1



Goals accomplished! ๐Ÿ™
โŸฉ | _ =>
none: {ฮฑ : Type ?u.230292} โ†’ Option ฮฑ
none
-- overflow theorem
Warning: declaration uses 'sorry'
{n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
z: Bitvec n
z
:
Bitvec: โ„• โ†’ Type
Bitvec
n} :
add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
add?
x: Bitvec n
x
y: Bitvec n
y
=
some: {ฮฑ : Type ?u.231111} โ†’ ฮฑ โ†’ Option ฮฑ
some
z: Bitvec n
z
โ†’
x: Bitvec n
x
+
y: Bitvec n
y
=
z: Bitvec n
z
:=
sorry: ?m.231167
sorry
/- #eval (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat * (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท).toNat #eval Bitvec.mul (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.toNat -/ protected def
mul?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
mul?
{n :
Nat: Type
Nat
} (
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n) :
Option: Type ?u.231182 โ†’ Type ?u.231182
Option
(
Bitvec: โ„• โ†’ Type
Bitvec
n) := do let
f: (r : ?m.231206) โ†’ (b : ?m.231214 r) โ†’ ?m.231215 r b
f
r: ?m.231206
r
b: ?m.231209
b
:= do let
opโ‚: ?m.231373
opโ‚
โ†
Bitvec.add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.add?
r: ?m.231206
r
r: ?m.231206
r
let
opโ‚‚: ?m.231422
opโ‚‚
โ†
Bitvec.add?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.add?
opโ‚: ?m.231373
opโ‚
y: Bitvec n
y
return
cond: {ฮฑ : Type ?u.231442} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
b: ?m.231209
b
opโ‚‚: ?m.231422
opโ‚‚
opโ‚: ?m.231373
opโ‚
(
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.231218} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
).
foldlM: {m : Type ?u.231228 โ†’ Type ?u.231227} โ†’ [inst : Monad m] โ†’ {s : Type ?u.231228} โ†’ {ฮฑ : Type ?u.231226} โ†’ (s โ†’ ฮฑ โ†’ m s) โ†’ s โ†’ List ฮฑ โ†’ m s
foldlM
f: (r : ?m.231206) โ†’ (b : ?m.231214 r) โ†’ ?m.231215 r b
f
0: ?m.231286
0
/- #eval Bitvec.mul? (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) #eval Bitvec.mul? (๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) (๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿถ๐Ÿท๐Ÿถ๐Ÿท๐Ÿท) |>.get!|>.toNat -/ theorem
Warning: declaration uses 'sorry'
: โˆ€ {n :
Nat: Type
Nat
} {
x: Bitvec n
x
y: Bitvec n
y
z: Bitvec n
z
:
Bitvec: โ„• โ†’ Type
Bitvec
n},
Bitvec.mul?: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Option (Bitvec n)
Bitvec.mul?
x: Bitvec n
x
y: Bitvec n
y
=
some: {ฮฑ : Type ?u.231917} โ†’ ฮฑ โ†’ Option ฮฑ
some
z: Bitvec n
z
โ†’
x: Bitvec n
x
*
y: Bitvec n
y
=
z: Bitvec n
z
:=
sorry: ?m.231981
sorry
/-- The value produced is the unsigned integer quotient of the two operands. Note that unsigned integer division and signed integer division are distinct operations; for signed integer division, use โ€˜sdivโ€™. Division by zero is undefined behavior. -/ def
udiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
udiv?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.232000 โ†’ Type ?u.232000
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := match
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
with | 0 =>
none: {ฮฑ : Type ?u.232027} โ†’ Option ฮฑ
none
| _ =>
some: {ฮฑ : Type ?u.232037} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w (
x: Bitvec w
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
/
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) /-- The value produced is the signed integer quotient of the two operands rounded towards zero. Note that signed integer division and unsigned integer division are distinct operations; for unsigned integer division, use โ€˜udivโ€™. Division by zero is undefined behavior. Overflow also leads to undefined behavior; this is a rare case, but can occur, for example, by doing a 32-bit division of -2147483648 by -1. -/ def
sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
sdiv?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.232361 โ†’ Type ?u.232361
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := if
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.232372
0
then
none: {ฮฑ : Type ?u.232410} โ†’ Option ฮฑ
none
else let
div: ?m.232414
div
:= (
x: Bitvec w
x
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
/
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
) if
div: ?m.232414
div
<
2: ?m.232481
2
^w then
some: {ฮฑ : Type ?u.232712} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w
div: ?m.232414
div
else
none: {ฮฑ : Type ?u.232714} โ†’ Option ฮฑ
none
/-- This instruction returns the unsigned integer remainder of a division. This instruction always performs an unsigned division to get the remainder. Note that unsigned integer remainder and signed integer remainder are distinct operations; for signed integer remainder, use โ€˜sremโ€™. Taking the remainder of a division by zero is undefined behavior. -/ def
urem?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
urem?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.233047 โ†’ Type ?u.233047
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := if
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
0: ?m.233058
0
then
none: {ฮฑ : Type ?u.233096} โ†’ Option ฮฑ
none
else
some: {ฮฑ : Type ?u.233099} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w (
x: Bitvec w
x
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
%
y: Bitvec w
y
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) def
_root_.Int.rem: โ„ค โ†’ โ„ค โ†’ โ„ค
_root_.Int.rem
(x y :
Int: Type
Int
) :
Int: Type
Int
:= if x โ‰ฅ
0: ?m.233273
0
then (x % y) else ((x % y) - |y|) -- TODO: prove this to make sure it's the right implementation! theorem
Warning: declaration uses 'sorry'
: โˆ€
x: ?m.233844
x
y: ?m.233847
y
,
Int.rem: โ„ค โ†’ โ„ค โ†’ โ„ค
Int.rem
x: ?m.233844
x
y: ?m.233847
y
<
0: ?m.233852
0
โ†”
x: ?m.233844
x
<
0: ?m.233882
0
:=

Goals accomplished! ๐Ÿ™

โˆ€ (x y : โ„ค), Int.rem x y < 0 โ†” x < 0

Goals accomplished! ๐Ÿ™
/-- This instruction returns the remainder of a division (where the result is either zero or has the same sign as the dividend, op1), not the modulo operator (where the result is either zero or has the same sign as the divisor, op2) of a value. For more information about the difference, see The Math Forum. For a table of how this is implemented in various languages, please see Wikipedia: modulo operation. Note that signed integer remainder and unsigned integer remainder are distinct operations; for unsigned integer remainder, use โ€˜uremโ€™. Taking the remainder of a division by zero is undefined behavior. For vectors, if any element of the divisor is zero, the operation has undefined behavior. Overflow also leads to undefined behavior; this is a rare case, but can occur, for example, by taking the remainder of a 32-bit division of -2147483648 by -1. (The remainder doesnโ€™t actually overflow, but this rule lets srem be implemented using instructions that return both the result of the division and the remainder.) -/ def
srem?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
srem?
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Option: Type ?u.233914 โ†’ Type ?u.233914
Option
$
Bitvec: โ„• โ†’ Type
Bitvec
w := if
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.233925
0
then
none: {ฮฑ : Type ?u.233963} โ†’ Option ฮฑ
none
else let
div: ?m.233967
div
:= (
x: Bitvec w
x
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
/
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
) if
div: ?m.233967
div
<
2: ?m.234034
2
^w then
some: {ฮฑ : Type ?u.234265} โ†’ ฮฑ โ†’ Option ฮฑ
some
$
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w (
x: Bitvec w
x
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
.
rem: โ„ค โ†’ โ„ค โ†’ โ„ค
rem
y: Bitvec w
y
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
) else
none: {ฮฑ : Type ?u.234273} โ†’ Option ฮฑ
none
/-- If the condition is an i1 and it evaluates to 1, the instruction returns the first value argument; otherwise, it returns the second value argument. -/ def
select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
select
{w :
Nat: Type
Nat
} (
c: Bitvec 1
c
:
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.234586
1
) (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Bitvec: โ„• โ†’ Type
Bitvec
w :=
cond: {ฮฑ : Type ?u.234611} โ†’ Bool โ†’ ฮฑ โ†’ ฮฑ โ†’ ฮฑ
cond
c: Bitvec 1
c
.
head: {ฮฑ : Type ?u.234613} โ†’ {n : โ„•} โ†’ Vector ฮฑ (Nat.succ n) โ†’ ฮฑ
head
x: Bitvec w
x
y: Bitvec w
y
theorem
bitwise_eq_eq: โˆ€ {w : โ„•} {x y : Bitvec w}, (โˆ€ (i : Fin w), x[i] = y[i]) โ†” x = y
bitwise_eq_eq
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w} : (forall
i: Fin w
i
:
Fin: โ„• โ†’ Type
Fin
w,
x: Bitvec w
x
[
i: Fin w
i
] =
y: Bitvec w
y
[
i: Fin w
i
]) โ†”
x: Bitvec w
x
=
y: Bitvec w
y
:= โŸจ
Vector.ext: โˆ€ {n : โ„•} {ฮฑ : Type ?u.235089} {v w : Vector ฮฑ n}, (โˆ€ (m : Fin n), Vector.get v m = Vector.get w m) โ†’ v = w
Vector.ext
, fun
h: ?m.235124
h
_: ?m.235127
_
=>
h: ?m.235124
h
โ–ธ
rfl: โˆ€ {ฮฑ : Sort ?u.235129} {a : ฮฑ}, a = a
rfl
โŸฉ theorem
ext_get?: โˆ€ {w : โ„•} {x y : Bitvec w}, (โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i) โ†’ x = y
ext_get?
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w} (
h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i
h
: โˆ€
i: ?m.235163
i
,
x: Bitvec w
x
.
toList: {ฮฑ : Type ?u.235167} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235172} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.235163
i
=
y: Bitvec w
y
.
toList: {ฮฑ : Type ?u.235178} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235181} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.235163
i
) :
x: Bitvec w
x
=
y: Bitvec w
y
:=

Goals accomplished! ๐Ÿ™
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y
x: List Bool

y: Bitvec (List.length x)

h: โˆ€ (i : โ„•), List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i = List.get? (Vector.toList y) i


mk
{ val := x, property := (_ : List.length x = List.length x) } = y
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y
x, y: List Bool

hy: List.length y = List.length x

h: โˆ€ (i : โ„•), List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i = List.get? (Vector.toList { val := y, property := hy }) i


mk.mk
{ val := x, property := (_ : List.length x = List.length x) } = { val := y, property := hy }
w: โ„•

x, y: Bitvec w

h: โˆ€ (i : โ„•), List.get? (Vector.toList x) i = List.get? (Vector.toList y) i


x = y

Goals accomplished! ๐Ÿ™
@[simp] theorem
toList_cong: โˆ€ {wโ‚ wโ‚‚ : โ„•} (h : wโ‚ = wโ‚‚) (b : Bitvec wโ‚), Vector.toList (Bitvec.cong h b) = Vector.toList b
toList_cong
{
wโ‚: โ„•
wโ‚
wโ‚‚: โ„•
wโ‚‚
:
Nat: Type
Nat
} (
h: wโ‚ = wโ‚‚
h
:
wโ‚: โ„•
wโ‚
=
wโ‚‚: โ„•
wโ‚‚
) (
b: Bitvec wโ‚
b
:
Bitvec: โ„• โ†’ Type
Bitvec
wโ‚: โ„•
wโ‚
) : (
Bitvec.cong: {a b : โ„•} โ†’ a = b โ†’ Bitvec a โ†’ Bitvec b
Bitvec.cong
h: wโ‚ = wโ‚‚
h
b: Bitvec wโ‚
b
).
toList: {ฮฑ : Type ?u.235340} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
=
b: Bitvec wโ‚
b
.
toList: {ฮฑ : Type ?u.235348} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
:=

Goals accomplished! ๐Ÿ™
wโ‚, wโ‚‚: โ„•

h: wโ‚ = wโ‚‚

b: Bitvec wโ‚


wโ‚: โ„•

b: Bitvec wโ‚


Vector.toList (Bitvec.cong (_ : wโ‚ = wโ‚) b) = Vector.toList b
wโ‚: โ„•

b: Bitvec wโ‚


Vector.toList (Bitvec.cong (_ : wโ‚ = wโ‚) b) = Vector.toList b
wโ‚, wโ‚‚: โ„•

h: wโ‚ = wโ‚‚

b: Bitvec wโ‚



Goals accomplished! ๐Ÿ™
theorem
get?_shl: โˆ€ {n : โ„•} (x : Bitvec n) (i j : โ„•), List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
get?_shl
(
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.235410
n
) (i j :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
shl
i).
toList: {ฮฑ : Type ?u.235425} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235430} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
j = if i + j <
n: ?m.235410
n
then
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.235486} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.235489} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(i + j) else if j <
n: ?m.235410
n
then
false: Bool
false
else
none: {ฮฑ : Type ?u.235619} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (Bitvec.cong (_ : n - i + min n i = n) (Vector.append (Vector.drop i x) (Vector.replicate (min n i) false)))) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool


mk
List.get? (Vector.toList (Bitvec.cong (_ : List.length x - i + min (List.length x) i = List.length x) (Vector.append (Vector.drop i { val := x, property := (_ : List.length x = List.length x) }) (Vector.replicate (min (List.length x) i) false)))) j = if i + j < List.length x then List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) (i + j) else if j < List.length x then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool


mk
List.get? (List.drop i x ++ List.replicate (min (List.length x) i) false) j = if i + j < List.length x then List.get? x (i + j) else if j < List.length x then some false else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
List.get? (List.drop i x) j = List.get? x (i + j)
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
List.get? x (i + j) = List.get? x (i + j)
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl
i, j: โ„•

x: List Bool

hโ‚: i + j < List.length x


mk.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
some (List.get (List.replicate (min (List.length x) i) false) { val := j - List.length (List.drop i x), isLt := ?mk.inr.inl }) = some false
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x



Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: j < List.length x


mk.inr.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (shl x i)) j = if i + j < n then List.get? (Vector.toList x) (i + j) else if j < n then some false else none
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌi + j < List.length x

hโ‚‚: ยฌj < List.length x


mk.inr.inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
get?_ushr: โˆ€ {n : โ„•} (x : Bitvec n) (i j : โ„•), List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
get?_ushr
(
x: Bitvec n
x
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.243006
n
) (i j :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
ushr: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
ushr
i).
toList: {ฮฑ : Type ?u.243021} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.243026} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
j = if j <
x: Bitvec n
x
.
length: {ฮฑ : Type ?u.243033} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ โ„•
length
then if j < i then
some: {ฮฑ : Type ?u.243066} โ†’ ฮฑ โ†’ Option ฮฑ
some
false: Bool
false
else
x: Bitvec n
x
.
toList: {ฮฑ : Type ?u.243069} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.243072} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(j - i) else
none: {ฮฑ : Type ?u.243119} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (fillShr x i false)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool


mk
List.get? (Vector.toList (fillShr { val := x, property := (_ : List.length x = List.length x) } i false)) j = if j < Vector.length { val := x, property := (_ : List.length x = List.length x) } then if j < i then some false else List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool


mk
List.get? (List.replicate (min (List.length x) i) false ++ List.take (List.length x - i) x) j = if j < Vector.length { val := x, property := (_ : List.length x = List.length x) } then if j < i then some false else List.get? x (j - i) else none
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
some (List.get (List.replicate (min (List.length x) i) false) { val := j, isLt := ?mk.inl.inl }) = some false
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: j < i


mk.inl.inl

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x



Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x



Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr
i, j: โ„•

x: List Bool

hโ‚: j < Vector.length { val := x, property := (_ : List.length x = List.length x) }

hโ‚‚: ยฌj < i

this: i < List.length x


mk.inl.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
n: โ„•

x: Bitvec n

i, j: โ„•


List.get? (Vector.toList (ushr x i)) j = if j < Vector.length x then if j < i then some false else List.get? (Vector.toList x) (j - i) else none
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: List.length x โ‰ค i


mk.inr.inl
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr

Goals accomplished! ๐Ÿ™
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }


mk.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr
i, j: โ„•

x: List Bool

hโ‚: ยฌj < Vector.length { val := x, property := (_ : List.length x = List.length x) }

h: ยฌList.length x โ‰ค i


mk.inr.inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
get?_and: โˆ€ {n : โ„•} (x y : Bitvec n) (i : โ„•), List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)
get?_and
(
x: Bitvec n
x
y: Bitvec n
y
:
Bitvec: โ„• โ†’ Type
Bitvec
n: ?m.261549
n
) (i :
โ„•: Type
โ„•
) : (
x: Bitvec n
x
.
and: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
and
y: Bitvec n
y
).
toList: {ฮฑ : Type ?u.261564} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.261569} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i = do return
(โ† x.toList.get? i): ?m.261652
(โ†
x: Bitvec n
x
(โ† x.toList.get? i): ?m.261652
.
toList: {ฮฑ : Type ?u.261642} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
(โ† x.toList.get? i): ?m.261652
.
get?: {ฮฑ : Type ?u.261645} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(โ† x.toList.get? i): ?m.261652
i
(โ† x.toList.get? i): ?m.261652
)
&&
(โ† y.toList.get? i): ?m.261708
(โ†
y: Bitvec n
y
(โ† y.toList.get? i): ?m.261708
.
toList: {ฮฑ : Type ?u.261699} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
(โ† y.toList.get? i): ?m.261708
.
get?: {ฮฑ : Type ?u.261702} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
(โ† y.toList.get? i): ?m.261708
i
(โ† y.toList.get? i): ?m.261708
)
:=

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk
List.get? (Vector.toList (Bitvec.and { val := x, property := (_ : List.length x = List.length x) } y)) i = do let __do_lift โ† List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk
List.get? (Vector.toList (Bitvec.and { val := x, property := (_ : List.length x = List.length x) } { val := y, property := hy })) i = do let __do_lift โ† List.get? (Vector.toList { val := x, property := (_ : List.length x = List.length x) }) i let __do_lift_1 โ† List.get? (Vector.toList { val := y, property := hy }) i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
n: โ„•

x, y: Bitvec n

i: โ„•


List.get? (Vector.toList (Bitvec.and x y)) i = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList y) i pure (__do_lift && __do_lift_1)

mk.mk.none
(Option.bind (Option.map and none) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† none let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† some valโœ let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk.none
(Option.bind (Option.map and none) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† none let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† some valโœ let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some.none
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g none) = do let __do_lift โ† some valโœ let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœยน, valโœ: Bool


mk.mk.some.some
(Option.bind (Option.map and (some valโœยน)) fun g => Option.map g (some valโœ)) = do let __do_lift โ† some valโœยน let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

mk.mk.none.none
(Option.bind (Option.map and none) fun g => Option.map g none) = do let __do_lift โ† none let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.none.some
(Option.bind (Option.map and none) fun g => Option.map g (some valโœ)) = do let __do_lift โ† none let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœ: Bool


mk.mk.some.none
(Option.bind (Option.map and (some valโœ)) fun g => Option.map g none) = do let __do_lift โ† some valโœ let __do_lift_1 โ† none pure (__do_lift && __do_lift_1)
i: โ„•

x, y: List Bool

hy: List.length y = List.length x

valโœยน, valโœ: Bool


mk.mk.some.some
(Option.bind (Option.map and (some valโœยน)) fun g => Option.map g (some valโœ)) = do let __do_lift โ† some valโœยน let __do_lift_1 โ† some valโœ pure (__do_lift && __do_lift_1)

mk.mk
(Option.bind (Option.map and (List.get? x i)) fun g => Option.map g (List.get? y i)) = do let __do_lift โ† List.get? x i let __do_lift_1 โ† List.get? y i pure (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
theorem
match_does_not_fold_away: โˆ€ {w : โ„•} {i : Fin (List.length (Vector.toList (Bitvec.ofInt w (-1))))}, List.get (Vector.toList (Bitvec.ofInt w (-1))) i = true
match_does_not_fold_away
:
List.get: {ฮฑ : Type ?u.312956} โ†’ (as : List ฮฑ) โ†’ Fin (List.length as) โ†’ ฮฑ
List.get
((
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w: ?m.312908
w
(-
1: ?m.312960
1
)).
toList: {ฮฑ : Type ?u.312977} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
)
i: ?m.312952
i
=
true: Bool
true
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

some (List.get (List.replicate w true) { val := โ†‘i, isLt := ?m.327984 }) = some true


Goals accomplished! ๐Ÿ™
theorem
get?_ofInt_neg_one: โˆ€ {w i : โ„•}, List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
get?_ofInt_neg_one
: (
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w: ?m.330033
w
(-
1: ?m.330082
1
)).
toList: {ฮฑ : Type ?u.330099} โ†’ {n : โ„•} โ†’ Vector ฮฑ n โ†’ List ฮฑ
toList
.
get?: {ฮฑ : Type ?u.330102} โ†’ List ฮฑ โ†’ โ„• โ†’ Option ฮฑ
get?
i: ?m.330076
i
= if
i: ?m.330076
i
<
w: ?m.330033
w
then
some: {ฮฑ : Type ?u.330125} โ†’ ฮฑ โ†’ Option ฮฑ
some
true: Bool
true
else
none: {ฮฑ : Type ?u.330128} โ†’ Option ฮฑ
none
:=

Goals accomplished! ๐Ÿ™
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: i < w


inl
some (List.get (Vector.toList (Bitvec.ofInt w (-1))) { val := i, isLt := ?inl }) = some true
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: i < w


inl
some (List.get (Vector.toList (Bitvec.ofInt w (-1))) { val := i, isLt := ?inl }) = some true
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: i < w


inl
some (List.get (Vector.toList (Bitvec.ofInt w (-1))) { val := i, isLt := ?inl }) = some true
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: i < w


inl
i < w
w, i: โ„•

h: i < w


inl
i < w
w, i: โ„•

h: i < w


inl
w, i: โ„•

h: ยฌi < w


inr

Goals accomplished! ๐Ÿ™
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•


List.get? (Vector.toList (Bitvec.ofInt w (-1))) i = if i < w then some true else none
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr
w, i: โ„•

h: ยฌi < w


inr

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
-- from InstCombine/Shift:279 theorem
shl_ushr_eq_and_shl: โˆ€ {w : โ„•} {x C : Bitvec w}, shl (ushr x (Bitvec.toNat C)) (Bitvec.toNat C) = Bitvec.and x (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))
shl_ushr_eq_and_shl
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
C: Bitvec w
C
:
Bitvec: โ„• โ†’ Type
Bitvec
w} :
Bitvec.shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.shl
(
Bitvec.ushr: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.ushr
x: Bitvec w
x
C: Bitvec w
C
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
)
C: Bitvec w
C
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
=
Bitvec.and: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.and
x: Bitvec w
x
(
Bitvec.shl: {n : โ„•} โ†’ Bitvec n โ†’ โ„• โ†’ Bitvec n
Bitvec.shl
(
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w (-
1: ?m.333966
1
))
C: Bitvec w
C
.
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) :=

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then List.get? (Vector.toList (ushr x (Bitvec.toNat C))) (Bitvec.toNat C + i) else if i < w then some false else none) = List.get? (Vector.toList (Bitvec.and x (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C)))) i
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < w then some false else none) = List.get? (Vector.toList (Bitvec.and x (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C)))) i
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < w then some false else none) = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))) i pure (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < Vector.length x then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < w then some false else none) = do let __do_lift โ† List.get? (Vector.toList x) i let __do_lift_1 โ† List.get? (Vector.toList (shl (Bitvec.ofInt w (-1)) (Bitvec.toNat C))) i pure (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < Bitvec.toNat C then some false else List.get? (Vector.toList x) (Bitvec.toNat C + i - Bitvec.toNat C) else none else if i < w then some false else none) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < w then some true else none else if i < w then some false else none) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•


h
(if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < w then List.get? (Vector.toList x) i else none else if i < w then some false else none) = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (if Bitvec.toNat C + i < w then if Bitvec.toNat C + i < w then some true else none else if i < w then some false else none) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: Bitvec.toNat C + i < w


h.inl
List.get? (Vector.toList x) i = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: Bitvec.toNat C + i < w


h.inl
List.get? (Vector.toList x) i = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: Bitvec.toNat C + i < w


h.inl
List.get? (Vector.toList x) i = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some true) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (some (List.get (Vector.toList x) { val := i, isLt := ?h.inr.inl })) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: i < w


h.inr.inl
some false = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind (some false) fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind none fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: w โ‰ค Bitvec.toNat C + i

hโ‚‚: w โ‰ค i


h.inr.inr
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: w โ‰ค Bitvec.toNat C + i

hโ‚‚: w โ‰ค i


h.inr.inr
w: โ„•

x, C: Bitvec w

i: โ„•

hโ‚: ยฌBitvec.toNat C + i < w

hโ‚‚: ยฌi < w


h.inr.inr
none = Option.bind (List.get? (Vector.toList x) i) fun __do_lift => Option.bind none fun __do_lift_1 => some (__do_lift && __do_lift_1)

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
-- A lot of this should probably go to a differet file here and not Mathlib inductive
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} :
Option: Type ?u.339769 โ†’ Type ?u.339769
Option
ฮฑ: Type u
ฮฑ
โ†’
Option: Type ?u.339772 โ†’ Type ?u.339772
Option
ฮฑ: Type u
ฮฑ
โ†’
Prop: Type
Prop
|
bothSome: โˆ€ {ฮฑ : Type u} {x y : ฮฑ}, x = y โ†’ Refinement (some x) (some y)
bothSome
{
x: ฮฑ
x
y: ฮฑ
y
:
ฮฑ: Type u
ฮฑ
} :
x: ฮฑ
x
=
y: ฮฑ
y
โ†’
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
(
some: {ฮฑ : Type ?u.339788} โ†’ ฮฑ โ†’ Option ฮฑ
some
x: ฮฑ
x
) (
some: {ฮฑ : Type ?u.339791} โ†’ ฮฑ โ†’ Option ฮฑ
some
y: ฮฑ
y
) |
noneAny: โˆ€ {ฮฑ : Type u} {x? : Option ฮฑ}, Refinement none x?
noneAny
{
x?: Option ฮฑ
x?
:
Option: Type ?u.339799 โ†’ Type ?u.339799
Option
ฮฑ: Type u
ฮฑ
} :
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
none: {ฮฑ : Type ?u.339803} โ†’ Option ฮฑ
none
x?: Option ฮฑ
x?
namespace Refinement theorem
Refinement.refl: โˆ€ {ฮฑ : Type u} (x : Option ฮฑ), Refinement x x
Refinement.refl
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} : โˆ€
x: Option ฮฑ
x
:
Option: Type ?u.339836 โ†’ Type ?u.339836
Option
ฮฑ: Type u
ฮฑ
,
Refinement: {ฮฑ : Type ?u.339839} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
x: Option ฮฑ
x
:=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

x: Option ฮฑ


ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

x: Option ฮฑ


ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u


none
Refinement none none
ฮฑ: Type u

valโœ: ฮฑ


some
Refinement (some valโœ) (some valโœ)
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

valโœ: ฮฑ


some
Refinement (some valโœ) (some valโœ)
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x
ฮฑ: Type u

valโœ: ฮฑ


some.a
valโœ = valโœ
ฮฑ: Type u

valโœ: ฮฑ


some.a
valโœ = valโœ
ฮฑ: Type u


โˆ€ (x : Option ฮฑ), Refinement x x

Goals accomplished! ๐Ÿ™
theorem
Refinement.trans: โˆ€ {ฮฑ : Type u} (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
Refinement.trans
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} : โˆ€
x: Option ฮฑ
x
y: Option ฮฑ
y
z: Option ฮฑ
z
:
Option: Type ?u.339950 โ†’ Type ?u.339950
Option
ฮฑ: Type u
ฮฑ
,
Refinement: {ฮฑ : Type ?u.339954} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
y: Option ฮฑ
y
โ†’
Refinement: {ฮฑ : Type ?u.339960} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
y: Option ฮฑ
y
z: Option ฮฑ
z
โ†’
Refinement: {ฮฑ : Type ?u.339964} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
x: Option ฮฑ
x
z: Option ฮฑ
z
:=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

z: Option ฮฑ

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ

hโ‚‚: Refinement (some yโœ) z


bothSome
Refinement (some xโœ) z
ฮฑ: Type u

y, z: Option ฮฑ

hโ‚‚: Refinement y z


noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

z: Option ฮฑ

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ

hโ‚‚: Refinement (some yโœ) z


bothSome
Refinement (some xโœ) z
ฮฑ: Type u

y, z: Option ฮฑ

hโ‚‚: Refinement y z


noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)
ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)
ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

x, y, z: Option ฮฑ

hโ‚: Refinement x y

hโ‚‚: Refinement y z


ฮฑ: Type u

xโœ, yโœ: ฮฑ

aโœ: xโœ = yโœ


noneAny.bothSome
Refinement none (some yโœ)
ฮฑ: Type u

z: Option ฮฑ


noneAny.noneAny
Refinement none z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome
Refinement (some xโœ) (some yโœ)
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u

xโœ, yโœยน: ฮฑ

aโœยน: xโœ = yโœยน

yโœ: ฮฑ

aโœ: yโœยน = yโœ


bothSome.bothSome.a
xโœ = yโœ
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
Refinement (some yโœ) (some y)
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u

x, yโœ: ฮฑ

hxy: x = yโœ

y: ฮฑ

h: yโœ = y


bothSome.bothSome
ฮฑ: Type u


โˆ€ (x y z : Option ฮฑ), Refinement x y โ†’ Refinement y z โ†’ Refinement x z

Goals accomplished! ๐Ÿ™
instance: {ฮฑ : Type u} โ†’ [inst : DecidableEq ฮฑ] โ†’ DecidableRel Refinement
instance
{
ฮฑ: Type u
ฮฑ
:
Type u: Type (u+1)
Type u
} [
DecidableEq: Sort ?u.340604 โ†’ Sort (max1?u.340604)
DecidableEq
ฮฑ: Type u
ฮฑ
] :
DecidableRel: {ฮฑ : Sort ?u.340613} โ†’ (ฮฑ โ†’ ฮฑ โ†’ Prop) โ†’ Sort (max1?u.340613)
DecidableRel
(@
Refinement: {ฮฑ : Type ?u.340615} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
ฮฑ: Type u
ฮฑ
) :=

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ


none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ

valโœ: ฮฑ


some
Decidable (Refinement (some valโœ) y)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ


none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

y: Option ฮฑ

valโœ: ฮฑ


some
Decidable (Refinement (some valโœ) y)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

x, y: Option ฮฑ


ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none.h
Refinement none none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none.h
Refinement none none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


none.none
Decidable (Refinement none none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some.h
Refinement none (some valโœ)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some.h
Refinement none (some valโœ)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


none.some
Decidable (Refinement none (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none.h
ยฌRefinement (some valโœ) none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none.h
ยฌRefinement (some valโœ) none
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ

h: Refinement (some valโœ) none


some.none.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ

h: Refinement (some valโœ) none


some.none.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœ: ฮฑ


some.none
Decidable (Refinement (some valโœ) none)
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ


DecidableRel Refinement
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ


some.some
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

h: Refinement (some val) (some val')


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

h: Refinement (some val) (some val')


some.some.isFalse.h
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

aโœ: val = val'


some.some.isFalse.h.bothSome
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'

aโœ: val = val'


some.some.isFalse.h.bothSome
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: ยฌval = val'


some.some.isFalse
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))

Goals accomplished! ๐Ÿ™
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

valโœยน, valโœ: ฮฑ


some.some
Decidable (Refinement (some valโœยน) (some valโœ))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h
Refinement (some val) (some val')
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h
Refinement (some val) (some val')
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h.a
val = val'
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue.h.a
val = val'
ฮฑ: Type u

instโœ: DecidableEq ฮฑ

val, val': ฮฑ

hโœ: val = val'


some.some.isTrue
Decidable (Refinement (some val) (some val'))

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
end Refinement infix:50 " โŠ‘ " =>
Refinement: {ฮฑ : Type u} โ†’ Option ฮฑ โ†’ Option ฮฑ โ†’ Prop
Refinement
instance: {w : โ„•} โ†’ DecidableEq (Bitvec w)
instance
{w :
Nat: Type
Nat
} :
DecidableEq: Sort ?u.349506 โ†’ Sort (max1?u.349506)
DecidableEq
(
Bitvec: โ„• โ†’ Type
Bitvec
w) :=
inferInstance: {ฮฑ : Sort ?u.349512} โ†’ [i : ฮฑ] โ†’ ฮฑ
inferInstance
theorem
toInt_injective: โˆ€ {w : โ„•}, Function.Injective Bitvec.toInt
toInt_injective
: โˆ€ {w :
Nat: Type
Nat
},
Function.Injective: {ฮฑ : Sort ?u.349741} โ†’ {ฮฒ : Sort ?u.349740} โ†’ (ฮฑ โ†’ ฮฒ) โ†’ Prop
Function.Injective
(
Bitvec.toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
Bitvec.toInt
:
Bitvec: โ„• โ†’ Type
Bitvec
w โ†’
โ„ค: Type
โ„ค
) | 0, โŸจ[],
_: List.length [] = 0
_
โŸฉ, โŸจ[], _โŸฉ,
rfl: โˆ€ {ฮฑ : Sort ?u.349774} {a : ฮฑ}, a = a
rfl
=>
rfl: โˆ€ {ฮฑ : Sort ?u.349869} {a : ฮฑ}, a = a
rfl
| n+1, โŸจ
a: Bool
a
::x,
hx: List.length (a :: x) = n + 1
hx
โŸฉ, โŸจ
b: Bool
b
::y,
hy: List.length (b :: y) = n + 1
hy
โŸฉ,
h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }
h
=>

Goals accomplished! ๐Ÿ™
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (false :: x) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (true :: x) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (false :: x) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x: List Bool

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

hx: List.length (true :: x) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: (bif a then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := a :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := a :: x, property := hx }))) = bif b then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := b :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := b :: y, property := hy }))


a
Vector.toList { val := a :: x, property := hx } = Vector.toList { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: Bitvec.toNat { val := x, property := (_ : Nat.pred (List.length (false :: x)) = Nat.pred (Nat.succ (n + 0))) } = Bitvec.toNat { val := y, property := (_ : Nat.pred (List.length (false :: y)) = Nat.pred (Nat.succ (n + 0))) }


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat { val := x, property := (_ : Nat.pred (List.length (false :: x)) = Nat.pred (Nat.succ (n + 0))) }) = (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat { val := y, property := (_ : Nat.pred (List.length (false :: y)) = Nat.pred (Nat.succ (n + 0))) })


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.false.false
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (false :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.false.true
Vector.toList { val := false :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (false :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif false then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := false :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := false :: y, property := hy }))


a.true.false
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := false :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

a: Bool

x: List Bool

hx: List.length (a :: x) = n + 1

b: Bool

y: List Bool

hy: List.length (b :: y) = n + 1

h: Bitvec.toInt { val := a :: x, property := hx } = Bitvec.toInt { val := b :: y, property := hy }


{ val := a :: x, property := hx } = { val := b :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: Bitvec.toNat (Bitvec.not { val := x, property := (_ : Nat.pred (List.length (true :: x)) = Nat.pred (Nat.succ (n + 0))) }) = Bitvec.toNat (Bitvec.not { val := y, property := (_ : Nat.pred (List.length (true :: y)) = Nat.pred (Nat.succ (n + 0))) })


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat (Bitvec.not { val := x, property := (_ : Nat.pred (List.length (true :: x)) = Nat.pred (Nat.succ (n + 0))) })) = (Vector.toList โˆ˜ Bitvec.ofNat n) (Bitvec.toNat (Bitvec.not { val := y, property := (_ : Nat.pred (List.length (true :: y)) = Nat.pred (Nat.succ (n + 0))) }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }
n: โ„•

x, y: List Bool

hx: List.length (true :: x) = n + 1

hy: List.length (true :: y) = n + 1

h: (bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: x, property := hx }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: x, property := hx }))) = bif true then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail { val := true :: y, property := hy }))) else โ†‘(Bitvec.toNat (Vector.tail { val := true :: y, property := hy }))


a.true.true
Vector.toList { val := true :: x, property := hx } = Vector.toList { val := true :: y, property := hy }

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_zero: โˆ€ {w : โ„•}, Bitvec.toInt 0 = 0
toInt_zero
{w :
Nat: Type
Nat
} : (
0: ?m.356099
0
:
Bitvec: โ„• โ†’ Type
Bitvec
w).
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.356131
0
:=

Goals accomplished! ๐Ÿ™

(match w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

zero
(match Nat.zero, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

Goals accomplished! ๐Ÿ™

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0
w: โ„•

thisโœ: Vector.head 0 = false

this: Vector.tail 0 = 0


succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

succ
(match Nat.succ w, 0 with | 0, x => 0 | Nat.succ n, v => bif Vector.head v then Int.negSucc (Bitvec.toNat (Bitvec.not (Vector.tail v))) else โ†‘(Bitvec.toNat (Vector.tail v))) = 0

Goals accomplished! ๐Ÿ™
@[simp] theorem
toInt_eq_zero: โˆ€ {w : โ„•} (b : Bitvec w), Bitvec.toInt b = 0 โ†” b = 0
toInt_eq_zero
{w :
Nat: Type
Nat
} (
b: Bitvec w
b
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
b: Bitvec w
b
.
toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
toInt
=
0: ?m.358799
0
โ†”
b: Bitvec w
b
=
0: ?m.358825
0
:=

Goals accomplished! ๐Ÿ™

Goals accomplished! ๐Ÿ™
theorem
toInt_one: โˆ€ {w : โ„•}, 1 < w โ†’ Bitvec.toInt 1 = 1
toInt_one
: โˆ€ {w :
โ„•: Type
โ„•
} (
_hw: 1 < w
_hw
:
1: ?m.358935
1
< w),
Bitvec.toInt: {n : โ„•} โ†’ Bitvec n โ†’ โ„ค
Bitvec.toInt
(
1: ?m.358974
1
:
Bitvec: โ„• โ†’ Type
Bitvec
w) =
1: ?m.358999
1
| w+2, _ =>

Goals accomplished! ๐Ÿ™
w: โ„•

xโœ: 1 < w + 2


w: โ„•

xโœ: 1 < w + 2

this: Vector.head 1 = false


w: โ„•

xโœ: 1 < w + 2


w: โ„•

xโœ: 1 < w + 2

thisโœ: Vector.head 1 = false

this: Vector.tail 1 = 1


w: โ„•

xโœ: 1 < w + 2



Goals accomplished! ๐Ÿ™
-- from InstCombine/:805 theorem
Warning: declaration uses 'sorry'
{w :
Nat: Type
Nat
} {
x: Bitvec w
x
:
Bitvec: โ„• โ†’ Type
Bitvec
w} (
hw: w > 1
hw
: w >
1: ?m.361719
1
) (
hx: x โ‰  0
hx
:
x: Bitvec w
x
โ‰ 
0: ?m.361752
0
) :
Bitvec.sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
Bitvec.sdiv?
1: ?m.361780
1
x: Bitvec w
x
=
Option.some: {ฮฑ : Type ?u.361803} โ†’ ฮฑ โ†’ Option ฮฑ
Option.some
(
Bitvec.select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
Bitvec.select
(((
x: Bitvec w
x
+
1: ?m.361816
1
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
<
3: ?m.361892
3
) ::แตฅ
Vector.nil: {ฮฑ : Type ?u.361944} โ†’ Vector ฮฑ 0
Vector.nil
)
x: Bitvec w
x
0: ?m.361947
0
) :=

Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)

Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


x: Bitvec 0

hw: 0 > 1

hx: x โ‰  0


x: Bitvec 0

hw: 0 > 1

hx: x โ‰  0


w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0



Goals accomplished! ๐Ÿ™
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0

hw0: w โ‰  0


(if 1 / Bitvec.toInt x < 2 ^ w then some (Bitvec.ofInt w (1 / Bitvec.toInt x)) else none) = some (if (Bitvec.toNat x + 1) % 2 ^ w < 3 then x else 0)
w: โ„•

x: Bitvec w

hw: w > 1

hx: x โ‰  0


sdiv? 1 x = some (select (decide (Bitvec.toNat (x + 1) < 3) ::แตฅ Vector.nil) x 0)

Goals accomplished! ๐Ÿ™
theorem
Warning: declaration uses 'sorry'
: (
Bitvec.sdiv?: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Option (Bitvec w)
Bitvec.sdiv?
(
Bitvec.ofInt: (n : โ„•) โ†’ โ„ค โ†’ Bitvec n
Bitvec.ofInt
w: ?m.362818
w
1: ?m.362846
1
)
x: ?m.362838
x
) โŠ‘
Option.some: {ฮฑ : Type ?u.362849} โ†’ ฮฑ โ†’ Option ฮฑ
Option.some
(
Bitvec.select: {w : โ„•} โ†’ Bitvec 1 โ†’ Bitvec w โ†’ Bitvec w โ†’ Bitvec w
Bitvec.select
((
Nat.blt: โ„• โ†’ โ„• โ†’ Bool
Nat.blt
(
Bitvec.add: {n : โ„•} โ†’ Bitvec n โ†’ Bitvec n โ†’ Bitvec n
Bitvec.add
x: ?m.362838
x
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.362818
w
1: ?m.362859
1
)).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.362818
w
3: ?m.362869
3
).
toNat: {n : โ„•} โ†’ Bitvec n โ†’ โ„•
toNat
) ::แตฅ
Vector.nil: {ฮฑ : Type ?u.362877} โ†’ Vector ฮฑ 0
Vector.nil
)
x: ?m.362838
x
(
Bitvec.ofNat: (n : โ„•) โ†’ โ„• โ†’ Bitvec n
Bitvec.ofNat
w: ?m.362818
w
0: ?m.362880
0
)) :=
sorry: ?m.362890
sorry
def
beq: {w : โ„•} โ†’ Bitvec w โ†’ Bitvec w โ†’ Bool
beq
{w :
Nat: Type
Nat
} (
x: Bitvec w
x
y: Bitvec w
y
:
Bitvec: โ„• โ†’ Type
Bitvec
w) :
Bool: Type
Bool
:=
x: Bitvec w
x
=
y: Bitvec w
y
def
fromBool: Bool โ†’ Bitvec 1
fromBool
:
Bool: Type
Bool
โ†’
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.362992
1
:= fun
b: ?m.363005
b
=>
b: ?m.363005
b
::แตฅ
Vector.nil: {ฮฑ : Type ?u.363012} โ†’ Vector ฮฑ 0
Vector.nil
instance: Coe Bool (Bitvec 1)
instance
:
Coe: semiOutParam (Sort ?u.363049) โ†’ Sort ?u.363048 โ†’ Sort (max(max1?u.363049)?u.363048)
Coe
Bool: Type
Bool
(
Bitvec: โ„• โ†’ Type
Bitvec
1: ?m.363051
1
) := โŸจ
fromBool: Bool โ†’ Bitvec 1
fromBool
โŸฉ end Bitvec